<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>订单列表</title>
    <style>
        .paging_simple_numbers{text-align:center;margin-top:20px;margin-bottom: 20px;}
        .paging_simple_numbers .pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
        .paging_simple_numbers .pagination .active{background-color: rgba(35,162,219,0.98);color: #fff;}
        .paging_simple_numbers .pagination .disabled{color:#aaa;}
    </style>
    {include file="public/header"/}
</head>
<body>
<div class="panel admin-panel">
    <form action="" id="formId" method="get">
        <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href=""
                                                                               style="float:right; display:none;">添加字段</a>
        </div>
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">
                <li><a class="button border-main icon-plus-square-o" href="goods_recycle.html"> 回收站</a></li>

                <li>搜索：</li>

                <li>
                    <select name="cate_id" style="padding:5px 15px; border:1px solid #ddd;">
                        <option value="">请选择分类</option>
                        {foreach name="cate" item="v"}

                        {if 0==$v['parent_id']}
                        <optgroup label="<{$v['cate_name']}>">11111<{$v['cate_name']}></optgroup>
                                {foreach name="cate" item="vv"}
                                {if $vv['parent_id']==$v['cate_id']}
                                <optgroup label="+++==<{$vv['cate_name']}>" {>2222222<{$vv['cate_name']}></optgroup>
                                        {foreach name="cate" item="vvv"}
                                        {if $vvv['parent_id']==$vv['cate_id']}
                                        <option value="<{$vvv['cate_id']}>" {eq name="cate_id" value="$vvv['cate_id']" }selected{/eq} >33333333<{$vvv['cate_name']}></option>
                        {/if}
                        {/foreach}
                        {/if}
                        {/foreach}
                        {/if}
                        {/foreach}
                    </select>
                </li>
                <li>
                    <span>价格区间</span>
                    <input type="nummber" name="price_min" placeholder="请输入最小价格" value="<{$data['price_min']|default=''}>">-
                    <input type="nummber" name="price_max" placeholder="请输入最大价格" value="<{$data['price_max']|default=''}>">
                </li>
                <li>
                    <span>时间区间</span>
                    <input type="date" name="add_time_min" placeholder="请输入最小时间" value="<{$data['add_time_min']|default=''}>">-
                    <input type="date" name="add_time_max" placeholder="请输入最大时间" value="<{$data['add_time_max']|default=''}>">
                </li>
                <li>
                    <span>是否推荐</span>
                    &nbsp;&nbsp;&nbsp;
                    <lable><input type="radio" name="recommended" value="2" checked>全部</lable>
                    <lable><input type="radio" name="recommended" value="1" {eq name="data['recommended']|default='2'" value="1" }checked{/eq}>是
                    </lable>
                    <lable><input type="radio" name="recommended" value="0" {eq name="data['recommended']|default='2'" value="0" }checked{/eq}>否
                    </lable>
                </li>
                <li>
                    <span>是否上架</span>
                    &nbsp;&nbsp;&nbsp;
                    <input type="checkbox" name="if_show[]" value="1" {in name="1" value="$data['if_show']|default=[]" }checked{/in}>是
                    <input type="checkbox" name="if_show[]" value="0" {in name="0" value="$data['if_show']|default=[]" }checked{/in}>否
                </li>
                <li>

                    <input type="text" placeholder="请输入搜索关键字" name="goods_name" class="input"
                           style="width:200px; line-height:17px;display:inline-block"
                           value="<{$goods_name|default=''}>"/>
                    <button href="javascript:F.submit();" class="button border-main icon-search"> 搜索</button>
                </li>
            </ul>
    </form>
</div>
<table class="table table-hover text-center">
    <tr>
        <th width="100" style="text-align:left; padding-left:20px;">ID</th>
        <th width="15%">商品名称</th>
        <th>图片</th>
        <th>价格</th>
        <th>分类名称</th>
        <th><a href="<{:url('',array_merge(request()->param(),['sj'=>$sj]))}>">
            {if $sj==1}
            上架时间
            {/if}
            {if $sj==2}
            上架时间↑
            {/if}
            {if $sj==3}
            上架时间↓
            {/if}

        </a></th>
        <th>品牌</th>
        <th>推荐</th>
        <th>上架</th>
        <th width="310">操作</th>
    </tr>
    {volist name="sp" id="v" empty="$empty"}
    <tr>
        <td style="text-align:left; padding-left:20px;"><input type="checkbox" class="goods_id" name="id[]" value="<{$v['goods_id']}>"/><{$v['goods_id']}>
        </td>
        <td><{$v['goods_name']|raw}></td>
        <td width="10%"><img src="/storage/<{$v['default_image']==''?'default.png':$v['default_image']}>" alt=""
                             width="70" height="50"/></td>
        <td><{$v['price']}></td>
        <td><{$v['ccate_name']}></td>
        <td><{$v['add_time']}></td>
        <td><{$v['bbrand_name']}></td>
        <td><font color="#00CC99">
            <img src="__IMAGES__/<{$v['recommended']}>" alt="">

        </font></td>
        <td><font color="#00CC99">
            <img src="__IMAGES__/<{$v['if_showg']}>" alt="">
        </font></td>
        <td>
            <div class="button-group"><a class="button border-main" href="<{:url('goods_edit',['id'=>$v['goods_id'],'param'=>$Request.param])}>"><span class="icon-edit"></span>
                修改</a> <a class="button border-red" href="<{:url('del',['id'=>$v['goods_id']])}>" onclick="return del(1,1,1)"><span
                    class="icon-trash-o"></span> 删除</a></div>
        </td>
    </tr>
    {/volist}

    <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
        全选
    </td>
    <td colspan="9" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)"
                                                                  class="button border-red icon-trash-o"
                                                                  style="padding:5px 15px;" onclick="DelSelect()">
        删除</a> <a href="javascript:void(0)" style="padding:5px 15px; margin:0 10px;"
                  class="button border-blue icon-edit" onclick="sorts()"> 排序</a> 操作：
        <select name="ishome" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeishome(this)">
            <option value="">首页</option>
            <option value="1">是</option>
            <option value="0">否</option>
        </select>
        <select name="isvouch" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeisvouch(this)">
            <option value="">推荐</option>
            <option value="1">是</option>
            <option value="0">否</option>
        </select>
        <select name="istop" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeistop(this)">
            <option value="">下架</option>
            <option value="1">是</option>
            <option value="0">否</option>
        </select>
    </td>
    </tr>



</table>

</div>
<{$sp|raw}>

<script type="text/javascript">
   // 单个删除
    function del(id,mid){
        if(confirm("您确定要删除吗?")){

        }else{
            return false;
        }
    }


    $(".shangjia").click(function () {
        var that = $(this);
        that.parent().parent().prev().children().shubmit();
        if (c == 1) {
            that.html("上架时间↓");
            // that=2;
            $(this).attr('c', '2');
        } else if (c == 2) {
            that.html("上架时间↑");
            $(this).attr('c', '3');
        } else {
            that.html("上架时间");
            $(this).attr('c', '1');

        }
        console.log(1);
    })


    //搜索
    function changesearch() {

    }



    //全选
    $("#checkall").click(function () {
        $("input[name='id[]']").each(function () {
            if (this.checked) {
                this.checked = false;
            }
            else {
                this.checked = true;
            }
        });
    })

   //批量删除
   $(".button").click(function(){
       var arr=[];
       $(".goods_id").each(function (index,object) {
           if($(object).prop("checked")){
               arr.push($(object).val());
           }
       })

       if(arr.length>0){
           if(confirm("确认删除吗？")){
               location.href="all_del?id="+arr.join(",");
           }
       }
   })

    //批量排序
    function sorts() {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {

            $("#listform").submit();
        }
        else {
            alert("请选择要操作的内容!");
            return false;
        }
    }


    //批量首页显示
    function changeishome(o) {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {

            $("#listform").submit();
        }
        else {
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量推荐
    function changeisvouch(o) {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {


            $("#listform").submit();
        }
        else {
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量置顶
    function changeistop(o) {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {

            $("#listform").submit();
        }
        else {
            alert("请选择要操作的内容!");

            return false;
        }
    }


    //批量移动
    function changecate(o) {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {

            $("#listform").submit();
        }
        else {
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量复制
    function changecopy(o) {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {
            var i = 0;
            $("input[name='id[]']").each(function () {
                if (this.checked == true) {
                    i++;
                }
            });
            if (i > 1) {
                alert("只能选择一条信息!");
                $(o).find("option:first").prop("selected", "selected");
            } else {

                $("#listform").submit();
            }
        }
        else {
            alert("请选择要复制的内容!");
            $(o).find("option:first").prop("selected", "selected");
            return false;
        }
    }

</script>
</body>
</html>